<template>
	<view class="content">
		<view class="" style="position: absolute; top: 0; width: 100%;">
			<image src="../../../static/images/work1.jpg" mode="" class="img_bg"></image>
		</view>
		<view class="" style=" top: 0; width: 100%;">
			<view class="popup_content1" style=" border-bottom: solid #808080 1upx; text-align: center; background-color: #fff; height: 90%;">
				<view class="display " style=" width: 100%;">
					<view class="display justify-between" style=" flex-wrap: nowrap; width: 200rpx;">
						<view class="">
							<image src="../../../static/person.png" mode="" style="width: 200rpx; height: 200rpx; margin-left: 0;"></image>
						</view>

					</view>
					<view class="margin-t30 " style="width: 270rpx;margin-left: 40rpx;">
						<view class="">
							<view class="display" style="width: 290rpx;">
								待巡检人：{{userDetail.nickname}}
							</view>
							<view class="margin-t30">
								<view class="display" style="width: 260rpx;">
									巡检点总数：{{count}}</view>
							</view>
						</view>
					</view>
				</view>
				<view class="display" style="border-bottom: solid 3upx #000000;">
					<view class="">
						<image src="../../../static/test.png" mode="" style="margin-top: 5rpx; width: 50rpx; height: 50rpx;"></image>
					</view>
					<view style="color: #ff6600; font-weight: normal; letter-spacing: 4upx;  font-size: 40upx;   text-align: left;">
						任务清单
					</view>
				</view>


				<view class="popup_content">
					<view class="text-left bg-white " style="border-radius: 3%; width: 100%;">
						<view class="card margin-t30 relative " style="" v-for="(item,index) in taskPosition" :key="index"  @tap="toDetail(item.danger_id,item.inspection_id)" >
							<image :src="item.type=='日检'?lable1:item.type=='周检'?lable2:lable3" style="margin-top: -30rpx; position: absolute; width: 30rpx; height: 60rpx;"
							 mode=""></image>
							<view class="margin-l40" :style="item.type=='日检'?'color:#ff5500':item.type=='周检'?'color:#ffaa00':'color:#00aaff'">
								<view class="display  text-30 " style="margin-top: -20rpx;  justify-content: left;">
									<view style="">{{item.danger_name}}</view>
									
								</view>
								<view class="line" style="margin-left: -20rpx;">
									
									<view class="display justify-between  text-28 margin-t20">
										<view class="" style="color: #090602; ">所在班次：</view>
										<view>{{item.inspection_name}}</view>
									</view>
									<view class="display justify-between  text-28 margin-t20">
										<view class="" style="color: #090602; ">巡检类型：</view>
										<view>{{item.type}}</view>
									</view>
									<view class="display justify-between">
									<view class="display  text-28 margin-t20">
										<view class="" style="color: #090602; ">已巡检次数：</view>
										<view>{{item.over_count}}</view>
									</view>
									<view class="display   text-28 margin-t20">
										<view class="" style="color: #090602; ">应巡检次数：</view>
										<view>{{item.count}}</view>
									</view>
									</view>
								</view>
							</view>
						</view>
					</view>
				</view>
			</view>

		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				company_name: '',
				userDetail: '',
				taskPosition: '',
				count: 0,
				lable1: '../../../static/lable_l.png',
				lable2: '../../../static/lable_l2.png',
				lable3: '../../../static/lable_3.png'
			}
		},
		onLoad() {
			this.userDetail = uni.getStorageSync("user");
			//console.log(this.userDetail)
			this.getMy_task()
		},
		methods: {
			getMy_task() {
				var that = this
				uni.request({
					url: 'https://aqmore.sxpz.vip/AppApi/User/my_task?uid=' + this.userDetail.uid + '&token=' + this.userDetail.token,
					method: 'GET',
					header: {
						'content-type': 'application/x-www-form-urlencoded'
					},
					success: function(res) {
						//console.log(res)
						that.taskPosition = res.data.datas;
						that.count = res.data.datas.length
					}
				})
			},
			toDetail(e,f){
				uni.navigateTo({
					url:'../../workspace/workDetial/polling/polling?id='+e+'&inspection_id=' + f 
				})
			}
		}
	}
</script>

<style>
	.line{
		border-top: #cbcbcb solid 1rpx;
		margin-left: -20rpx;
	}
	.popup_content {
		position: fixed;
		left: 7%;
		width: 80%;
		height: 70%;
		font-size: 36upx;
		color: #ff6600;
		border: 10px solid white;
		background-color: white;
		z-index: 1002;
		overflow: auto;
		border-radius: 20upx;
	}

	.popup_content1 {
		top: 3%;
		position: fixed;
		left: 7%;
		width: 80%;
		border: 10px solid white;
		background-color: white;
		z-index: 1002;
		overflow: auto;
		border-radius: 20upx;
	}

	/* 总数提示 */
	.popup_content2 {
		color: #FF0000;
		font-size: 28upx;
		top: 88%;
		display: inline-block;
		position: fixed;
		right: -10%;
		width: 60%;
		border: 10upx solid white;
		z-index: 1002;
		overflow: auto;
		border-radius: 20upx;
	}
</style>
